package com.five.service.impl;

import com.five.dao.SchoolActivitiesMapper;
import com.five.entity.SchoolActivities;
import com.five.service.SchoolActivitiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Zero on 2018/2/26.
 */
@Service("SchoolActivitiesService")
public class SchoolActivitiesServiceImpl implements SchoolActivitiesService {


    @Autowired
    private SchoolActivitiesMapper schoolActivitiesMapper;


    /**
     * 查找学生活动信息
     * @param activitiesType
     * @return
     */
    @Override
    public List<SchoolActivities> findSchoolActivitiesByActivitiesType(String activitiesType) {
        return schoolActivitiesMapper.selectByActivitiesType(activitiesType);
    }

    /**
     * 添加活动信息
     * @param schoolActivities
     * @return
     */
    @Override
    public int addSchoolActivities(SchoolActivities schoolActivities) {
        return schoolActivitiesMapper.insertSelective(schoolActivities);
    }


    /**
     * 查找最新活动信息
     * @param startNumber
     * @param endNumber
     * @return
     */
    @Override
    public List<SchoolActivities> findNewActivitiesByNumber(Integer startNumber, Integer endNumber) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("startNumber", startNumber);
        params.put("endNumber", endNumber);
        return schoolActivitiesMapper.selectNewActivitiesByNumber(params);
    }


}
